package repositories

import (
	"gitee.com/RocsSun/report/dbs"
	"gitee.com/RocsSun/report/models"
	"gorm.io/gorm"
)

var d *gorm.DB = dbs.Client

type ReportCurd struct {
	db *gorm.DB
}

func NewReportCurd() *ReportCurd {
	return &ReportCurd{
		db: d,
	}
}

func (r *ReportCurd) Create(m interface{}) {
	r.db.Create(m)
}

func (r *ReportCurd) InsertDevOpsNetFlowData(m ...*models.NetFlowData) {
	r.db.Create(m)
}

func (r *ReportCurd) GetLastTradetNetWork() []*models.NetFlowData {
	var ms []*models.NetFlowData = make([]*models.NetFlowData, 5)
	r.db.Where("To_Days(checked_date) = To_Days( ? )", "2021-04-18").Find(&ms)
	return ms
}
